﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using MxitAPI;

namespace MxitGUI {
    public partial class NewSubcriptionWindow : Form {

        public RawSubscription RawSubscription { get; set; }

        public NewSubcriptionWindow( RawSubscription rawSubscription ) {
            InitializeComponent();
            RawSubscription = rawSubscription;
            Init();
        }

        private void Init() {
            if ( RawSubscription.HiddenLoginName == 0 )
                lblUserName.Text = RawSubscription.ContactAddress;
            txtNickName.Text = RawSubscription.NickName;
            lblContactType.Text = RawSubscription.ContactType.ToString();
            lblInviteMessage.Text = RawSubscription.InviteMessage;
            
        }

        private void btnAccept_Click( object sender, EventArgs e ) {
            AllowSubscriptionHandler handler = new AllowSubscriptionHandler( RawSubscription.ContactAddress, txtGroup.Text, txtNickName.Text );
            handler.Execute();
            Close();
        }

        private void btnDecline_Click( object sender, EventArgs e ) {
            DenySubscriptionHandler handler = new DenySubscriptionHandler( RawSubscription.ContactAddress );
            handler.Execute();
            Close();
        }

        private void btnCancel_Click( object sender, EventArgs e ) {
            Close();
        }

    }
}
